package thread;
/*
* 线程提供了一个静态方法:
* static Thread currentThread()
* 该方法可以获得运行这个方法的线程*/
public class ThreadInfoDemo {
    public static void main(String[] args) {
        Thread main=Thread.currentThread();
        System.out.println(main);
        doSome();


    }
    public static void doSome(){
        Thread t=Thread.currentThread();
        System.out.println(t);
        String name=t.getName();
        System.out.println("线程名字:"+name);
        long id=t.getId();
        System.out.println("id:"+id);
        int priority=t.getPriority();
        System.out.println("优先级:"+priority);
        boolean daemon = t.isDaemon();
        System.out.println("是否是守护线程:"+daemon);
        boolean interrupted = t.isInterrupted();
        System.out.println("是否被中断:"+interrupted);
        boolean alive = t.isAlive();
        System.out.println("是否存活:"+alive);
    }
}
